package cn.com.Kol.ITPMP.TenMajorAreas.model;

import cn.com.Kol.ITPMP.System.Area;
import cn.com.Kol.ITPMP.System.Process;

import static cn.com.Kol.ITPMP.System.Constants.*;

public class ProcurementManagement extends Area {

    private Process MakeProcurementManagementPlan = new Process(MAKE_PROCUREMENT_MANAGEMENT_PLAN);
    private Process ImplementProcurement = new Process(IMPLEMENT_PROCUREMENT);
    private Process ControlProcurements = new Process(CONTROL_PROCUREMENTS);
    private Process CloseProcurements = new Process(CLOSE_PROCUREMENTS);

    private void ProcurementManagementProcess(){
        CreateProcess(MakeProcurementManagementPlan);
        CreateProcess(ImplementProcurement);
        CreateProcess(ControlProcurements);
        CreateProcess(CloseProcurements);
    }

    public void SetInputs(Process process){
        switch (process.getProcessName()){
            case "规划采购":
                process.inputs(PROJECT_MANAGEMENT_PLAN);
                process.inputs(REQUIREMENTS_DOCUMENTATION);
                process.inputs(RISK_REGISTER);
                process.inputs(ACTIVITY_RESOURCE_REQUIREMENTS);
                process.inputs(PROJECT_SCHEDULE);
                process.inputs(ACTIVITY_COST_ESTIMATE);
                process.inputs(STAKEHOLDER_REGISTER);
                process.inputs(ENTERPRISE_ENVIRONMENTAL_FACTORS);
                process.inputs(ORGANIZATIONAL_PROCESS_ASSETS);
                break;
            case "实施采购":
                process.inputs(PROCUREMENT_MANAGEMENT_PLAN);
                process.inputs(PROCUREMENT_FILE);
                process.inputs(SUPPLIER_SELECTION_CRITERIA);
                process.inputs(SELLER_PROPOSAL);
                process.inputs(PROJECT_FILE);
                process.inputs(MAKE_OR_BUY_DECISION);
                process.inputs(PROCUREMENT_STATEMENT_OF_WORK);
                process.inputs(ORGANIZATIONAL_PROCESS_ASSETS);
                break;
            case "控制采购":
                process.inputs(PROJECT_MANAGEMENT_PLAN);
                process.inputs(PROCUREMENT_FILE);
                process.inputs(CONTRACT);
                process.inputs(APPROVED_CHANGE_REQUESTS);
                process.inputs(WORK_PERFORMANCE_REPORT);
                process.inputs(WORK_PERFORMANCE_DATA);
                break;
            case "结束采购":
                process.inputs(PROJECT_MANAGEMENT_PLAN);
                process.inputs(PROCUREMENT_FILE);
                break;
        }
    }

    public void UseToolAndTech(Process process){
        switch (process.getProcessName()){
            case "规划采购":
                process.useToolAndTech(ORGANIZATIONAL_PROCESS_ASSETS);
                process.useToolAndTech(EXPERT_JUDGEMENT);
                process.useToolAndTech(MARKET_RESEARCH);
                process.useToolAndTech(CONFERENCE);
                break;
            case "实施采购":
                process.useToolAndTech(BIDDERS_CONFERENCE);
                process.useToolAndTech(PROPOSAL_EVALUATION_TECHNIQUES);
                process.useToolAndTech(INDEPENDENT_ESTIMATES);
                process.useToolAndTech(EXPERT_JUDGEMENT);
                process.useToolAndTech(ADVERTISEMENT);
                process.useToolAndTech(ANALYSIS_TECHNICS);
                process.useToolAndTech(ACQUISITION_NEGOTIATIONS);
                break;
            case "控制采购":
                process.useToolAndTech(CONTRACT_CHANGE_CONTROL_SYSTEM);
                process.useToolAndTech(PROCUREMENT_PERFORMANCE_REVIEW);
                process.useToolAndTech(INSPECTION_AND_AUDIT);
                process.useToolAndTech(PERFORMANCE_REPORT);
                process.useToolAndTech(PAYMENT_SYSTEM);
                process.useToolAndTech(CLAIMS_MANAGEMENT);
                process.useToolAndTech(RECORDS_MANAGEMENT_SYSTEM);
                break;
            case "结束采购":
                process.useToolAndTech(PROCUREMENT_AUDIT);
                process.useToolAndTech(ACQUISITION_NEGOTIATIONS);
                process.useToolAndTech(RECORDS_MANAGEMENT_SYSTEM);
                break;
        }
    }

    public void SetOutputs(Process process){
        switch (process.getProcessName()){
            case "规划采购":
                process.outputs(PROCUREMENT_MANAGEMENT_PLAN);
                process.outputs(PROCUREMENT_STATEMENT_OF_WORK);
                process.outputs(PROCUREMENT_FILE);
                process.outputs(SUPPLIER_SELECTION_CRITERIA);
                process.outputs(MAKE_OR_BUY_DECISION);
                process.outputs(CHANGE_REQUESTS);
                break;
            case "实施采购":
                process.outputs(SELECTED_VENDOR);
                process.outputs(PROTOCOL);
                process.outputs(RESOURCE_CALENDAR);
                process.outputs(CHANGE_REQUESTS);
                process.outputs(PROJECT_MANAGEMENT_PLAN_UPDATE);
                process.outputs(PROJECT_FILE_UPDATE);
                break;
            case "控制采购":
                process.outputs(WORK_PERFORMANCE_INFO);
                process.outputs(CHANGE_REQUESTS);
                process.outputs(PROJECT_MANAGEMENT_PLAN_UPDATE);
                process.outputs(PROJECT_FILE_UPDATE);
                process.outputs(ORGANIZATIONAL_PROCESS_ASSETS_UPDATE);
                break;
            case "结束采购":
                process.outputs(FINISHED_PROCUREMENTS);
                process.outputs(ORGANIZATIONAL_PROCESS_ASSETS_UPDATE);
                break;
        }

    }
}
